home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / lastcall.dxr / 00132_init stuff.ls < prev    next >
Encoding:
Text File  |  2000-03-27  |  10.0 KB  |  300 lines

  1. global gTable, debug
  2.  
  3. on initGlassware
  4.   global gGlassware, gOldGlassware
  5.   if gOldGlassware then
  6.     gGlassware = getOldGlasswareDB()
  7.     exit
  8.   end if
  9.   gGlassware = [:]
  10.   initDB("recipes.v12", "glassware")
  11.   mOrderBy(gTable, "gwID")
  12.   mSelectAll(gTable)
  13.   temp = mGetSelection(gTable, "PropertyList")
  14.   repeat with X = 1 to count(temp)
  15.     thisGlass = symbol(temp[X][#glassware])
  16.     addProp(gGlassware, thisGlass, temp[X])
  17.     deleteProp(gGlassware[thisGlass], #glassware)
  18.   end repeat
  19.   closeDB()
  20. end
  21.  
  22. on initGameLevels
  23.   global gGameSetup, gOldGameLevels
  24.   if gOldGameLevels then
  25.     gGameSetup = getOldGameLevelsDB()
  26.     exit
  27.   end if
  28.   gGameSetup = [:]
  29.   initDB("LevelInfo.v12", "LevelInfo")
  30.   mOrderBy(gTable, "level")
  31.   mSelectAll(gTable)
  32.   gGameSetup = mGetSelection(gTable, "PropertyList")
  33.   closeDB()
  34.   repeat with thisLevel in gGameSetup
  35.     thisLevel[#duration] = minutes(thisLevel[#duration])
  36.     thisLevel[#wo1] = seconds(thisLevel[#WaitingOrder1])
  37.     thisLevel[#wo2] = seconds(thisLevel[#WaitingOrder2])
  38.     thisLevel[#wo3] = seconds(thisLevel[#WaitingOrder3])
  39.     thisLevel[#wo4] = seconds(thisLevel[#WaitingOrder4])
  40.     deleteProp(thisLevel, #WaitingOrder1)
  41.     deleteProp(thisLevel, #WaitingOrder2)
  42.     deleteProp(thisLevel, #WaitingOrder3)
  43.     deleteProp(thisLevel, #WaitingOrder4)
  44.     thisLevel[#ws1] = seconds(thisLevel[#waitingServe1])
  45.     thisLevel[#ws2] = seconds(thisLevel[#waitingServe2])
  46.     thisLevel[#ws3] = seconds(thisLevel[#WaitingServe3])
  47.     deleteProp(thisLevel, #waitingServe1)
  48.     deleteProp(thisLevel, #waitingServe2)
  49.     deleteProp(thisLevel, #WaitingServe3)
  50.     thisLevel[#newCharacterMinInterval] = seconds(thisLevel[#newCharacterMinInterval])
  51.     thisLevel[#newCharacterMaxInterval] = seconds(thisLevel[#newCharacterMaxInterval])
  52.     thisLevel[#orderAnticChance] = integer(100 * thisLevel[#AnticOrderLikely])
  53.     thisLevel[#serveAnticChance] = integer(100 * thisLevel[#AnticServeLikely])
  54.     thisLevel[#postDrinkAnticChance] = integer(100 * thisLevel[#postDrinkAnticLikely])
  55.     thisLevel[#postDrinkStayChance] = integer(100 * thisLevel[#stayLikely])
  56.     deleteProp(thisLevel, #AnticOrderLikely)
  57.     deleteProp(thisLevel, #AnticServeLikely)
  58.     deleteProp(thisLevel, #postDrinkAnticLikely)
  59.     deleteProp(thisLevel, #stayLikely)
  60.   end repeat
  61. end
  62.  
  63. on initFlashRects
  64.   global gFlashRects, gOldFlashRects
  65.   if gOldFlashRects then
  66.     gFlashRects = getOldFlashRectsDB()
  67.     demoCharactersOnly(gFlashRects)
  68.     exit
  69.   end if
  70.   gFlashRects = [:]
  71.   initDB("characters.v12", "SpecialRec")
  72.   mOrderBy(gTable, "CHname")
  73.   mSelectAll(gTable)
  74.   mGoFirst(gTable)
  75.   temp = mGetSelection(gTable, "PropertyList")
  76.   closeDB()
  77.   repeat with X = 1 to count(temp)
  78.     thisChar = symbol(temp[X][#CHNAME])
  79.     if voidp(gFlashRects[thisChar]) then
  80.       gFlashRects[thisChar] = [:]
  81.     end if
  82.     addProp(gFlashRects[thisChar], symbol(temp[X][#action]), value("rect" & temp[X][#SPECIALREC]))
  83.   end repeat
  84. end
  85.  
  86. on demoCharactersOnly trimList
  87.   global gDemoVersion, gDemoCharacters
  88.   if gDemoVersion then
  89.     maxCount = count(trimList)
  90.     repeat with X = maxCount down to 1
  91.       if not findPos(gDemoCharacters, getPropAt(trimList, X)) then
  92.         deleteAt(trimList, X)
  93.       end if
  94.     end repeat
  95.   end if
  96. end
  97.  
  98. on initCharInfo
  99.   global gImplementedCharacters, gOldCharInfo
  100.   if gOldCharInfo then
  101.     gImplementedCharacters = getOldCharInfoDB()
  102.     demoCharactersOnly(gImplementedCharacters)
  103.     exit
  104.   end if
  105.   gImplementedCharacters = [:]
  106.   initDB("characters.v12", "Tcharacter_name")
  107.   mSelectAll(gTable)
  108.   temp = mGetSelection(gTable, "PropertyList")
  109.   if debug then
  110.     put "Found" && count(temp) && "characters names"
  111.   end if
  112.   repeat with X = 1 to count(temp)
  113.     thisChar = symbol(temp[X][#character_code])
  114.     addProp(gImplementedCharacters, thisChar, temp[X])
  115.     thisChar2 = gImplementedCharacters[thisChar]
  116.     deleteProp(thisChar2, #character_code)
  117.     deleteProp(thisChar2, #id)
  118.     tempGlassXY = value(thisChar2[#glassXY])
  119.     if voidp(tempGlassXY) then
  120.       debugAlert("Problem with glassXY for" && thisChar && thisChar2[#glassXY])
  121.       thisChar2[#glassXY] = [#def: point(0, 0)]
  122.     else
  123.       thisChar2[#glassXY] = tempGlassXY
  124.     end if
  125.     thisChar2[#regPoint] = value("point" & thisChar2[#regPoint])
  126.     thisChar2[#RegPointMouth] = value("point" & thisChar2[#RegPointMouth])
  127.     thisChar2[#SexPref] = value("list" & thisChar2[#SexPref])
  128.     if thisChar2[#IMPATIENCE] = EMPTY then
  129.       thisChar2[#IMPATIENCE] = 1.0
  130.     else
  131.       thisChar2[#IMPATIENCE] = value(thisChar2[#IMPATIENCE])
  132.     end if
  133.     thisChar2[#P1A] = value(thisChar2[#POS1ALLOW])
  134.     thisChar2[#P2A] = value(thisChar2[#POS2ALLOW])
  135.     thisChar2[#P3A] = value(thisChar2[#POS3ALLOW])
  136.     deleteProp(thisChar2, #POS1ALLOW)
  137.     deleteProp(thisChar2, #POS2ALLOW)
  138.     deleteProp(thisChar2, #POS3ALLOW)
  139.     if thisChar2[#POS1FREE] = EMPTY then
  140.       thisChar2[#P1F] = []
  141.     else
  142.       thisChar2[#P1F] = value(thisChar2[#POS1FREE])
  143.     end if
  144.     deleteProp(thisChar2, #POS1FREE)
  145.     if thisChar2[#POS2FREE] = EMPTY then
  146.       thisChar2[#P2F] = []
  147.     else
  148.       thisChar2[#P2F] = value(thisChar2[#POS2FREE])
  149.     end if
  150.     deleteProp(thisChar2, #POS2FREE)
  151.     if thisChar2[#POS3FREE] = EMPTY then
  152.       thisChar2[#P3F] = []
  153.     else
  154.       thisChar2[#P3F] = value(thisChar2[#POS3FREE])
  155.     end if
  156.     deleteProp(thisChar2, #POS3FREE)
  157.     if thisChar2[#UNDERAGEM] = EMPTY then
  158.       thisChar2[#UM] = 0
  159.     else
  160.       thisChar2[#UM] = value(thisChar2[#UNDERAGEM])
  161.     end if
  162.     deleteProp(thisChar2, #UNDERAGEM)
  163.     if thisChar2[#UNDERAGED] = EMPTY then
  164.       thisChar2[#UD] = 0
  165.     else
  166.       thisChar2[#UD] = value(thisChar2[#UNDERAGED])
  167.     end if
  168.     deleteProp(thisChar2, #UNDERAGEM)
  169.     if thisChar2[#UNDERAGEY] = EMPTY then
  170.       thisChar2[#UY] = 0
  171.     else
  172.       thisChar2[#UY] = value(thisChar2[#UNDERAGEY])
  173.     end if
  174.     deleteProp(thisChar2, #UNDERAGEY)
  175.     thisChar2[#UF] = value(thisChar2[#UNDERAGEFREQ])
  176.     deleteProp(thisChar2, #UNDERAGEFREQ)
  177.     thisChar2[#MINLEVEL] = value(thisChar2[#MINLEVEL])
  178.     if thisChar2[#EXCLUDECHAR] = "VOID" then
  179.       thisChar2[#EXCLUDECHAR] = []
  180.       next repeat
  181.     end if
  182.     thisChar2[#EXCLUDECHAR] = value(thisChar2[#EXCLUDECHAR])
  183.   end repeat
  184.   closeDB()
  185. end
  186.  
  187. on reinitializeCharacters
  188.   initCharActions()
  189. end
  190.  
  191. on reinitializeBarTopManager
  192.   global gBarTopManager, gRegisterBell
  193.   gBarTopManager = new(script("Bar Spot Manager"))
  194.   mInitialize(gBarTopManager)
  195.   gRegisterBell = new(script("Register Bell"))
  196. end
  197.  
  198. on startNewGame
  199.   global gBarTopManager, gPlayerTips, gGameLevel, gPlayerCardWarnings, gGenderMishaps, gRecipeWindowWarnings, gWastingLiquorWarnings, gRecipeWindowOpenTime, gPlayerDrinkTickets, gWarnedAboutGlassesUnderBar, gLastSavedGameName
  200.   gLastSavedGameName = EMPTY
  201.   gPlayerDrinkTickets = 0
  202.   gRecipeWindowOpenTime = 0
  203.   gRecipeWindowWarnings = 0
  204.   gWastingLiquorWarnings = 0
  205.   gWarnedAboutGlassesUnderBar = 0
  206.   gGenderMishaps = 0
  207.   reinitializeCharacters()
  208.   gPlayerTips = 0
  209.   gPlayerCardWarnings = 0
  210. end
  211.  
  212. on initCharActions
  213.   global gCharacterActions, gImplementedCharacters, gOldCharActions, gCharChildren
  214.   startTimer()
  215.   gCharChildren = [:]
  216.   if debug then
  217.     put "Before readcharactions" && the timer
  218.   end if
  219.   if gOldCharActions then
  220.     if voidp(gCharacterActions) then
  221.       gCharacterActions = getOldCharActionsDB()
  222.     end if
  223.     demoCharactersOnly(gCharacterActions)
  224.   else
  225.     gCharacterActions = [:]
  226.     initDB("characters.v12", "Taction_list")
  227.   end if
  228.   if debug then
  229.     put "Before repeat" && the timer
  230.   end if
  231.   repeat with Y = count(gImplementedCharacters) down to 1
  232.     charCode = getPropAt(gImplementedCharacters, Y)
  233.     addProp(gCharChildren, charCode, new(script("Character persistent  parent script"), charCode))
  234.     if not gOldCharActions then
  235.       addProp(gCharacterActions, charCode, readCharacterDatabase(charCode))
  236.     end if
  237.     charActions = gCharChildren[charCode][#pCharacterActions]
  238.     if debug >= 3 then
  239.       checkCharActions(gCharChildren[charCode])
  240.     end if
  241.     if (charActions = VOID) or (charActions = [:]) then
  242.       put "Unless you are resetting the database right now, this is very bad. There are no actions for" && charCode
  243.       deleteAt(gImplementedCharacters, Y)
  244.       next repeat
  245.     end if
  246.     if debug >= 3 then
  247.       put "Put in repeat" && the timer
  248.     end if
  249.   end repeat
  250.   closeDB()
  251.   if debug then
  252.     put "Before verification" && the timer
  253.   end if
  254.   repeat with Y = 1 to count(gImplementedCharacters)
  255.     charCode = getPropAt(gImplementedCharacters, Y)
  256.     verifyLabels = 0
  257.     if verifyLabels then
  258.       spriteNum = barSlotToSprite(1)
  259.       sprite(spriteNum).member = flashMember(charCode)
  260.       updateStage()
  261.       sprite(spriteNum).member.fileName = sprite(spriteNum).member.fileName
  262.       charActions = getCharActions(charCode)
  263.       repeat with zzz = 1 to count(charActions)
  264.         actions = charActions[zzz]
  265.         steps = actions[1]
  266.         if not listp(steps) then
  267.           put "No valid steps for" && getPropAt(charActions, zzz) && "for character" && charCode
  268.           next repeat
  269.         end if
  270.         repeat with stepNum = 1 to count(steps)
  271.           case getPropAt(steps, stepNum) of
  272.             #anim:
  273.               if findLabel(sprite(spriteNum), steps[stepNum]) = 0 then
  274.                 err = "Missing label" && steps[stepNum] && "in Flash member for character" && charCode && "for action" && getPropAt(charActions, zzz)
  275.               end if
  276.             #vo:
  277.               soundFile = VOpath(charCode, steps[stepNum])
  278.               if authoring() then
  279.                 if not FileExists(soundFile) then
  280.                   put "Missing sound file" && soundFile
  281.                 end if
  282.               end if
  283.             #V0:
  284.               put "Error, should be Vee-Oh, not Vee-Zero" && charCode && getPropAt(charActions, zzz) && VOpath(charCode, steps[stepNum])
  285.             #RID:
  286.             #otherwise:
  287.               put "Unrecognized action in database:" && getPropAt(steps, stepNum) && steps[stepNum]
  288.           end case
  289.         end repeat
  290.       end repeat
  291.       if debug >= 3 then
  292.         put " in verification" && the timer
  293.       end if
  294.     end if
  295.   end repeat
  296.   if debug then
  297.     put "After verification" && the timer
  298.   end if
  299. end
  300.